<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
// var_dump(strtotime('2018-08-24 13:34:11'));die;
$where=' WHERE  uniacid=:uniacid and state=:state  ';
$data[':uniacid']=$_W['uniacid'];
$data[':state']=4;

$wheres=' WHERE  uniacid=:uniacid and pay=:pay and state=:state  ';
$datas[':uniacid']=$_W['uniacid'];
$datas[':pay']=1;
$datas[':state']=2;

$wheress=' WHERE  uniacid=:uniacid ';
$datass[':uniacid']=$_W['uniacid'];

$wherec=' WHERE  uniacid=:uniacid and pay=:pay ';
$datac[':uniacid']=$_W['uniacid'];
$datac[':pay']=1;

$todaytime=strtotime(date('Y-m-d',time()));
$yesterdaytime=strtotime(date('Y-m-d',time()))-86400;
$weektime=strtotime(date('Y-m-d',time()))-7*86400;
$monthtime=strtotime(date('Y-m-d',time()))-30*86400;
$todaynum=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$todaytime} ORDER BY time desc",$data);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
$todaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$todaytime.")",$datac);
if ($todaynum>0) {
	$todayfeess=array();
	$todayfeesss=array();
	$todayfees=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$todaytime} ORDER BY time desc",$data);
	$todayfeess0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
	$todayfeess1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
	$todayfeess2=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
	$todayfeess3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
	$todayfeess4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$todaytime.")",$datas);
	$todayfeesss0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
	$todayfeesss1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
	$todayfeesss2=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
	$todayfeesss3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
	$todayfeesss4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
	$todayfeeslook=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$todaytime.")",$datass);
	$todayfeescus=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$todaytime.")",$datac);
	if ($todayfeess0) {
		for ($i=0; $i <count($todayfeess0) ; $i++) { 
			array_push($todayfeess, $todayfeess0[$i]);
		}
	}
	if ($todayfeess1) {
		for ($i=0; $i <count($todayfeess1) ; $i++) { 
			array_push($todayfeess, $todayfeess1[$i]);
		}
	}
	if ($todayfeess2) {
		for ($i=0; $i <count($todayfeess2) ; $i++) { 
			array_push($todayfeess, $todayfeess2[$i]);
		}
	}
	if ($todayfeess3) {
		for ($i=0; $i <count($todayfeess3) ; $i++) { 
			array_push($todayfeess, $todayfeess3[$i]);
		}
	}
	if ($todayfeess4) {
		for ($i=0; $i <count($todayfeess4) ; $i++) { 
			array_push($todayfeess, $todayfeess4[$i]);
		}
	}
	if ($todayfeesss0) {
		for ($i=0; $i <count($todayfeesss0) ; $i++) { 
			array_push($todayfeesss, $todayfeesss0[$i]);
		}
	}
	if ($todayfeesss1) {
		for ($i=0; $i <count($todayfeesss1) ; $i++) { 
			array_push($todayfeesss, $todayfeesss1[$i]);
		}
	}
	if ($todayfeesss2) {
		for ($i=0; $i <count($todayfeesss2) ; $i++) { 
			array_push($todayfeesss, $todayfeesss2[$i]);
		}
	}
	if ($todayfeesss3) {
		for ($i=0; $i <count($todayfeesss3) ; $i++) { 
			array_push($todayfeesss, $todayfeesss3[$i]);
		}
	}
	if ($todayfeesss4) {
		for ($i=0; $i <count($todayfeesss4) ; $i++) { 
			array_push($todayfeesss, $todayfeesss4[$i]);
		}
	}
	$todaymoneys=0;
	for ($i=0; $i <count($todayfees) ; $i++) { 
		$todaymoneys+=$todayfees[$i]['ofees'];
	}
	for ($i=0; $i <count($todayfeess) ; $i++) { 
		$todaymoneys+=$todayfeess[$i]['payfee'];
	}
	for ($i=0; $i <count($todayfeesss) ; $i++) { 
		$todaymoneys+=$todayfeesss[$i]['fee'];
	}

	for ($i=0; $i <count($todayfeeslook) ; $i++) { 
		$todaymoneys+=$todayfeeslook[$i]['fee'];
	}
	for ($i=0; $i <count($todayfeescus) ; $i++) { 
		$todaymoneys+=$todayfeescus[$i]['payfee'];
	}
	$todayavg=$todaymoneys/$todaynum;
}

$yesterdaynum=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$yesterdaytime} and timesjc<{$todaytime} ORDER BY time desc",$data);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
$yesterdaynum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datac);
if ($yesterdaynum>0) {
	$yesterdayfeess=array();
	$yesterdayfeesss=array();
	$yesterdayfees=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$yesterdaytime} ORDER BY time desc",$data);
$yesterdayfeess0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdayfeess1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdayfeess2=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdayfeess3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
$yesterdayfeess4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datas);
	$yesterdayfeesss0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
	$yesterdayfeesss1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
	$yesterdayfeesss2=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
	$yesterdayfeesss3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
	$yesterdayfeesss4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
	$yesterdayfeeslook=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datass);
	$yesterdayfeescus=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$yesterdaytime.")",$datac);
	if ($yesterdayfeess0) {
		for ($i=0; $i <count($yesterdayfeess0) ; $i++) { 
			array_push($yesterdayfeess, $yesterdayfeess0[$i]);
		}
	}
	if ($yesterdayfeess1) {
		for ($i=0; $i <count($yesterdayfeess1) ; $i++) { 
			array_push($yesterdayfeess, $yesterdayfeess1[$i]);
		}
	}
	if ($yesterdayfeess2) {
		for ($i=0; $i <count($yesterdayfeess2) ; $i++) { 
			array_push($yesterdayfeess, $yesterdayfeess2[$i]);
		}
	}
	if ($yesterdayfeess3) {
		for ($i=0; $i <count($yesterdayfeess3) ; $i++) { 
			array_push($yesterdayfeess, $yesterdayfeess3[$i]);
		}
	}
	if ($yesterdayfeess4) {
		for ($i=0; $i <count($yesterdayfeess4) ; $i++) { 
			array_push($yesterdayfeess, $yesterdayfeess4[$i]);
		}
	}
	if ($yesterdayfeesss0) {
		for ($i=0; $i <count($yesterdayfeesss0) ; $i++) { 
			array_push($yesterdayfeesss, $yesterdayfeesss0[$i]);
		}
	}
	if ($yesterdayfeesss1) {
		for ($i=0; $i <count($yesterdayfeesss1) ; $i++) { 
			array_push($yesterdayfeesss, $yesterdayfeesss1[$i]);
		}
	}
	if ($yesterdayfeesss2) {
		for ($i=0; $i <count($yesterdayfeesss2) ; $i++) { 
			array_push($yesterdayfeesss, $yesterdayfeesss2[$i]);
		}
	}
	if ($yesterdayfeesss3) {
		for ($i=0; $i <count($yesterdayfeesss3) ; $i++) { 
			array_push($yesterdayfeesss, $yesterdayfeesss3[$i]);
		}
	}
	if ($yesterdayfeesss4) {
		for ($i=0; $i <count($yesterdayfeesss4) ; $i++) { 
			array_push($yesterdayfeesss, $yesterdayfeesss4[$i]);
		}
	}
	$yesterdaymoneys=0;
	for ($i=0; $i <count($yesterdayfees) ; $i++) { 
		$yesterdaymoneys+=$yesterdayfees[$i]['ofees'];
	}
	for ($i=0; $i <count($yesterdayfeess) ; $i++) { 
		$yesterdaymoneys+=$yesterdayfeess[$i]['payfee'];
	}
	for ($i=0; $i <count($yesterdayfeesss) ; $i++) { 
		$yesterdaymoneys+=$yesterdayfeesss[$i]['fee'];
	}

	for ($i=0; $i <count($yesterdayfeeslook) ; $i++) { 
		$yesterdaymoneys+=$yesterdayfeeslook[$i]['fee'];
	}
	for ($i=0; $i <count($yesterdayfeescus) ; $i++) { 
		$yesterdaymoneys+=$yesterdayfeescus[$i]['payfee'];
	}
	$yesterdayavg=$yesterdaymoneys/$yesterdaynum;
}

$weeknum=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$weektime} ORDER BY time desc",$data);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
$weeknum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$weektime.")",$datac);
if ($weeknum>0) {
	$weekfeess=array();
	$weekfeesss=array();
	$weekfees=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$weektime} ORDER BY time desc",$data);
$weekfeess0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weekfeess1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weekfeess2=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weekfeess3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
$weekfeess4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$weektime.")",$datas);
	$weekfeesss0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
	$weekfeesss1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
	$weekfeesss2=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
	$weekfeesss3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
	$weekfeesss4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
	$weekfeeslook=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$weektime.")",$datass);
	$weekfeescus=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$weektime.")",$datac);
	if ($weekfeess0) {
		for ($i=0; $i <count($weekfeess0) ; $i++) { 
			array_push($weekfeess, $weekfeess0[$i]);
		}
	}
	if ($weekfeess1) {
		for ($i=0; $i <count($weekfeess1) ; $i++) { 
			array_push($weekfeess, $weekfeess1[$i]);
		}
	}
	if ($weekfeess2) {
		for ($i=0; $i <count($weekfeess2) ; $i++) { 
			array_push($weekfeess, $weekfeess2[$i]);
		}
	}
	if ($weekfeess3) {
		for ($i=0; $i <count($weekfeess3) ; $i++) { 
			array_push($weekfeess, $weekfeess3[$i]);
		}
	}
	if ($weekfeess4) {
		for ($i=0; $i <count($weekfeess4) ; $i++) { 
			array_push($weekfeess, $weekfeess4[$i]);
		}
	}
	if ($weekfeesss0) {
		for ($i=0; $i <count($weekfeesss0) ; $i++) { 
			array_push($weekfeesss, $weekfeesss0[$i]);
		}
	}
	if ($weekfeesss1) {
		for ($i=0; $i <count($weekfeesss1) ; $i++) { 
			array_push($weekfeesss, $weekfeesss1[$i]);
		}
	}
	if ($weekfeesss2) {
		for ($i=0; $i <count($weekfeesss2) ; $i++) { 
			array_push($weekfeesss, $weekfeesss2[$i]);
		}
	}
	if ($weekfeesss3) {
		for ($i=0; $i <count($weekfeesss3) ; $i++) { 
			array_push($weekfeesss, $weekfeesss3[$i]);
		}
	}
	if ($weekfeesss4) {
		for ($i=0; $i <count($weekfeesss4) ; $i++) { 
			array_push($weekfeesss, $weekfeesss4[$i]);
		}
	}
	$weekmoneys=0;
	for ($i=0; $i <count($weekfees) ; $i++) { 
		$weekmoneys+=$weekfees[$i]['ofees'];
	}
	for ($i=0; $i <count($weekfeess) ; $i++) { 
		$weekmoneys+=$weekfeess[$i]['payfee'];
	}
	for ($i=0; $i <count($weekfeesss) ; $i++) { 
		$weekmoneys+=$weekfeesss[$i]['fee'];
	}
	for ($i=0; $i <count($weekfeeslook) ; $i++) { 
		$weekmoneys+=$weekfeeslook[$i]['fee'];
	}
	for ($i=0; $i <count($weekfeescus) ; $i++) { 
		$weekmoneys+=$weekfeescus[$i]['payfee'];
	}
	$weekavg=$weekmoneys/$weeknum;
}

$monthnum=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$monthtime} ORDER BY time desc",$data);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
$monthnum+=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$monthtime.")",$datac);
if ($monthnum>0) {
	$monthfeess=array();
	$monthfeesss=array();
	$monthfees=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_orders').$where." and timesjc>={$monthtime} ORDER BY time desc",$data);
	$monthfeess0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dbpublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
	$monthfeess1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotpublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
	$monthfeess3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketpublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
	$monthfeess4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storepublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
	$monthfeess5=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_pripublish').$wheres." and time >=FROM_UNIXTIME(".$monthtime.")",$datas);
	$monthfeesss0=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_dborder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
	$monthfeesss1=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_shotorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
	$monthfeesss2=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_marketorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
	$monthfeesss3=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_storeorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
	$monthfeesss4=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_priorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
	$monthfeeslook=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_prilookorder').$wheress." and time >=FROM_UNIXTIME(".$monthtime.")",$datass);
	$monthfeescus=pdo_fetchall("SELECT * FROM ".tablename('zh_gjw_cusmanage').$wherec." and time >=FROM_UNIXTIME(".$monthtime.")",$datac);
	if ($monthfeess0) {
		for ($i=0; $i <count($monthfeess0) ; $i++) { 
			array_push($monthfeess, $monthfeess0[$i]);
		}
	}
	if ($monthfeess1) {
		for ($i=0; $i <count($monthfeess1) ; $i++) { 
			array_push($monthfeess, $monthfeess1[$i]);
		}
	}
	if ($monthfeess2) {
		for ($i=0; $i <count($monthfeess2) ; $i++) { 
			array_push($monthfeess, $monthfeess2[$i]);
		}
	}
	if ($monthfeess3) {
		for ($i=0; $i <count($monthfeess3) ; $i++) { 
			array_push($monthfeess, $monthfeess3[$i]);
		}
	}
	if ($monthfeess4) {
		for ($i=0; $i <count($monthfeess4) ; $i++) { 
			array_push($monthfeess, $monthfeess4[$i]);
		}
	}
	if ($monthfeesss0) {
		for ($i=0; $i <count($monthfeesss0) ; $i++) { 
			array_push($monthfeesss, $monthfeesss0[$i]);
		}
	}
	if ($monthfeesss1) {
		for ($i=0; $i <count($monthfeesss1) ; $i++) { 
			array_push($monthfeesss, $monthfeesss1[$i]);
		}
	}
	if ($monthfeesss2) {
		for ($i=0; $i <count($monthfeesss2) ; $i++) { 
			array_push($monthfeesss, $monthfeesss2[$i]);
		}
	}
	if ($monthfeesss3) {
		for ($i=0; $i <count($monthfeesss3) ; $i++) { 
			array_push($monthfeesss, $monthfeesss3[$i]);
		}
	}
	if ($monthfeesss4) {
		for ($i=0; $i <count($monthfeesss4) ; $i++) { 
			array_push($monthfeesss, $monthfeesss4[$i]);
		}
	}
	$monthmoneys=0;
	for ($i=0; $i <count($monthfees) ; $i++) { 
		$monthmoneys+=$monthfees[$i]['ofees'];
	}
	for ($i=0; $i <count($monthfeess) ; $i++) { 
		$monthmoneys+=$monthfeess[$i]['payfee'];
	}
	for ($i=0; $i <count($monthfeesss) ; $i++) { 
		$monthmoneys+=$monthfeesss[$i]['fee'];
	}

	for ($i=0; $i <count($monthfeeslook) ; $i++) { 
		$monthmoneys+=$monthfeeslook[$i]['fee'];
	}
	for ($i=0; $i <count($monthfeescus) ; $i++) { 
		$monthmoneys+=$monthfeescus[$i]['payfee'];
	}
	$monthavg=$monthmoneys/$monthnum;
}

include $this->template('web/orders');